package com.rany.day04.demo04;

public class DemoComputer {
    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.powerOn();

        //鼠标向上转型为USB类型
        USB usbMouse = new Mouse();
        //将鼠标USB类型传递进方法
        computer.useDrive(usbMouse);

        //键盘类型
        KeyBoard keyBoard = new KeyBoard();
        computer.useDrive(keyBoard);
        //使用匿名对象
        computer.useDrive(new KeyBoard());

        computer.powerOf();
    }
}
